package com.example.cd5160866.urlapp;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.example.cd5160866.urlapp.view.LineDrawable;

/**
 * Created by cd5160866 on 2017/8/11.
 */

public class LineActivity extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_line);

        int colorGray = Color.parseColor("#BCBCBC");

        View viewHorizontal = findViewById(R.id.v_horizontal);
        View viewVertical = findViewById(R.id.v_vertical);

        new LineDrawable(LineDrawable.HORIZONTAL, colorGray, viewHorizontal);
        new LineDrawable(LineDrawable.VERTICAL, colorGray, 10, 10, viewVertical);


    }

    /**
     * 可以在这个方法中添加我们需要传递的参数
     */
    public static void start(Activity activity) {
        start(activity, new Intent(activity, LineActivity.class));
    }

    public static void start(Activity activity, Intent intent) {
        activity.startActivity(intent);
        activity.overridePendingTransition(R.anim.slide_in_from_bottom, R.anim.animation_static);
        //第二个参数不能为0 否则会出现黑块
        //activity.overridePendingTransition(R.anim.slide_in_from_bottom, 0);
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.slide_out_from_bottom);
    }
}
